const packageName = require('./package.json').name
const { defineConfig } = require('@vue/cli-service')

module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    output: {
      library: `${packageName}-[name]`,
      libraryTarget: 'umd',
      chunkLoadingGlobal: `webpackJsonp_${packageName}`
    },
    devServer: {
      open: true,
      host: 'localhost',
      port: 8080,
      historyApiFallback: true,
      allowedHosts: 'all',
      headers: {
        'Access-Control-Allow-Origin': '*'
      },
      proxy: {
        '/api': {
          target: 'http://xxx.xxx.xxx:8081/',
          pathRewrite: {
            '^/api': ''
          },
          changeOrigin: true,
          secure: false
        }
      }
    }
  }
})
